package com.hero.tweaks.util;

import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.EditText;

import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;

public class AxisPreferenceFragment extends PreferenceFragment {

	protected Context mContext;

	public ContentResolver Cr;

	protected ContentResolver mContentRes;

	public int mSeekbarProgress;
	public EditText settingText;
	SharedPreferences mPreferences;

	/*
	 * The name is intentionally made different from Activity#finish(), so that
	 * users won't misunderstand its meaning.
	 */
	public final void finishFragment() {
		getActivity().onBackPressed();
	}

	/**
	 * Returns the ContentResolver from the owning Activity.
	 */
	protected ContentResolver getContentResolver() {
		return getActivity().getContentResolver();
	}

	protected Context getParentActivityContext() {
		return getActivity().getApplicationContext();
	}

	// Some helpers for functions used by the settings fragments when they were
	// activities

	/**
	 * Returns the specified system service from the owning Activity.
	 */
	protected Object getSystemService(final String name) {
		return getActivity().getSystemService(name);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mContext = getActivity();
		mContentRes = getActivity().getContentResolver();
	}

	public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
			Preference preference, String key) {
		// TODO Auto-generated method stub
		return false;
	}

	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
			String key) {
		// TODO Auto-generated method stub

	}

	public void setTitle(int resId) {
		getActivity().setTitle(resId);
	}

}